CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
IF(COMMAND cmake_policy)
	CMAKE_POLICY(SET CMP0003 NEW)
	CMAKE_POLICY(SET CMP0002 OLD)
ENDIF(COMMAND cmake_policy)


PROJECT(tiary)

SET(TIARY_MAJOR_VERSION 0)
SET(TIARY_MINOR_VERSION 1)
SET(TIARY_PATCH_VERSION 1)
SET(TIARY_COPYRIGHT_YEAR 2009)

SET(CMAKE_COLOR_MAKEFILE ON)
#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
#SET(CMAKE_BUILD_TYPE Debug)

IF(CMAKE_COMPILER_IS_GNUC)
	SET(CMAKE_C_FLAGS "-Wall")
ENDIF(CMAKE_COMPILER_IS_GNUC)
IF(CMAKE_COMPILER_IS_GNUCXX)
	SET(CMAKE_CXX_FLAGS "-Wall")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)


ADD_DEFINITIONS("-DTIARY_MAJOR_VERSION=${TIARY_MAJOR_VERSION}")
ADD_DEFINITIONS("-DTIARY_MINOR_VERSION=${TIARY_MINOR_VERSION}")
ADD_DEFINITIONS("-DTIARY_PATCH_VERSION=${TIARY_PATCH_VERSION}")
ADD_DEFINITIONS("-DTIARY_COPYRIGHT_YEAR=${TIARY_COPYRIGHT_YEAR}")
ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/src")

ADD_SUBDIRECTORY(src)

INSTALL(
	FILES ${CMAKE_BINARY_DIR}/src/tiary
	DESTINATION bin/
	PERMISSIONS
		OWNER_EXECUTE OWNER_WRITE OWNER_READ
		GROUP_EXECUTE GROUP_READ
		WORLD_EXECUTE WORLD_READ
)



MESSAGE(STATUS)
MESSAGE(STATUS "CMAKE_BUILD_TYPE  =  ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS)
